All Questions
6 questions
3votes
2answers
497views
Enforcing the way of object construction in interface a good practise or not?
As far as I understood it is already not possible languages like Java, C# etc. Because the method name of defining constructor in these languages must be same with the class name. That because I'll ...
13votes
3answers
6kviews
Composition over inheritance but
I'm trying to teach myself software engineering and coming up against some conflicting information which is confusing me. I've been learning OOP and what abstract classes / Interfaces are and how to ...
2votes
2answers
527views
Lesser of two evils regarding return types
I'm implementing a system in PHP where values are represented with objects that implement an Amount interface. I'm building two different implementations of this interface, one using a simple integer ...
3votes
1answer
233views
Interface hierarchy design for separate domains
There are businesses and people. People could be liked and businesses could be commented on: class Like class Comment class Person implements iLikeTarget class Business implements iCommentTarget ...
5votes
4answers
3kviews
Which methods should be put in an interface and which in abstract classes?
I have seen many frameworks and modules and their standard they follow is like this UserInterface which have some predefined methods AbstractUserClass which implements userInterface Then ...
34votes
11answers
21kviews
Why does PHP have interfaces?
I noticed that as of PHP5, interfaces have been added to the language. However, since PHP is so loosely typed, it seems that most of the benefits of using interfaces is lost. Why is this included in ...